package com.etcn.modules.busi.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.etcn.common.controller.BaseController;
import com.etcn.modules.busi.order.pojo.WmInvoice;
import com.etcn.modules.busi.order.service.IWmInvoiceService;

import org.springframework.web.bind.annotation.ResponseBody;
import com.etcn.common.annotation.Manage;

/**
 * 发票controller
 * 
 * @author guozc
 * @date: 2018-03-20 13:18:02
 */
@Controller
@RequestMapping("/v1/invoices")
public class WmInvoiceController extends BaseController {

	@Autowired
	private IWmInvoiceService wmInvoiceService;

	/**
	 * 添加发票
	 */
	@Manage
	@RequestMapping(value = "add", method = RequestMethod.POST)
	public @ResponseBody void add(@RequestBody WmInvoice wmInvoice) throws Exception {
		wmInvoiceService.add(wmInvoice);
	}
	
	/**
	 * 查询会员发票
	 */
	@Manage
	@RequestMapping(value = "", method = RequestMethod.GET)
	public @ResponseBody Object getMemberInvoices() throws Exception {
		return wmInvoiceService.getMemberInvoices();
	}
	
	/**
	 * 查询会员发票详情
	 */
	@Manage
	@RequestMapping(value = "/{id}", method = RequestMethod.GET)
	public @ResponseBody Object getDetail(@PathVariable("id") long id) throws Exception {
		return wmInvoiceService.getById(id);
	}

}